Introduction to Data Models
We will look at the meaning behind data models and the different types of models.
In order to store data in a database system, we need some data-structures. Hence the database systems we use normally include some complex data structures which we normally do not use. To make the system efficient in terms of data retrieval, and reduce complexity in terms of usability, developers use data abstraction i.e., hide irrelevant details from the users.
In order to achieve this abstraction, we use data models.
A data model is a collection of concepts or notations for describing data, data relationships, data semantics, and data constraints.
We will highlight what these terms mean in the next few lessons.
Most data models also include a set of basic operations for manipulating data in the database.
Types of data models#
The different types of data models can be classified into the following categories:
1. High-level conceptual data models#
High-level conceptual data models provide a way to present data that is similar to how people perceive data. A typical example is an entity-relationship model, which uses concepts like entities, attributes, and relationships.
Entity relationship model#
An entity represents a real-world object such as an employee or a project. The entity has attributes that represent properties such as an employee’s name, address, and birthdate. A relationship represents an association among entities; for example, an employee works on many projects. A relationship exists between the employee and each project.
2. Record-based logical data models#
Record-based logical data models provide concepts users can understand but are still similar to the way data is stored on the computer. Three well-known data models of this type are: hierarchical, network, and relational data models.
Hierarchical model#
In a hierarchical model, data is organized into a tree-like structure, implying a single parent for each record. This structure mandates that each child record has only one parent, whereas each parent record can have one or more child records. This concept is illustrated below:
Network model#
The network model expands upon the hierarchical structure, allowing each record to have multiple parent and child records, forming a generalized graph structure. It was the most popular model before being replaced by the relational model. The network model is shown in the diagram below:
Relational model#
The relational model represents data as relations or tables. For example, the university database system contains multiple tables (relations) which in turn have several attributes (columns) and tuples (rows).
3. Physical data models#
The physical data model represents how data is stored in computer memory, how it is scattered and ordered in the memory, and how it would be retrieved from memory. Basically physical data model represents each table, its columns, and specifications, etc. It also highlights how tables are built and related to each other in the database. The diagrammatic representation of physical models is shown below:
As we can see the STUDENT table consists of attributes like Std_Id
, Std_Name
, Age
etc. along with their data type. Same for the DEPARTMENT table. The arrow simply shows how these two tables are connected in this model.
In the next lesson, we will discuss schemas and instances.